package rs.dalao.syc.index.controller;/*
 *   @author:Casin
 *   @date:2023/8/4
 *   @code:
 */

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import rs.dalao.syc.common.response.JsonResult;
import rs.dalao.syc.index.pojo.vo.*;
import rs.dalao.syc.index.service.IEncyclopediaService;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/encyclopedia/")
@Api(tags = "3. 百科全书")
public class EncyclopediaController {
    @Autowired
    IEncyclopediaService service;

    public EncyclopediaController() {
        log.debug("创建控制器类对象：EncyclopediaController");
    }

    @GetMapping("/encList/departments")
    @ApiOperation("百科全书上方科室展示")
    public JsonResult selectDep(){
        List<DepartmentVO> departmentVOS = service.selectDep();
        return JsonResult.ok(departmentVOS);
    }
    @GetMapping("/encList/{depId}")
    @ApiOperation("百科全书list")
    public JsonResult selectByDepId(@PathVariable Long depId){
        List<EncContentListVO> encContentListVOS = service.selectByDepId(depId);
        return JsonResult.ok(encContentListVOS);
    }

    @GetMapping("/encList/otherDoc/{depId}")
    @ApiOperation("百科全书list其他医生")
    public JsonResult getOtherDocByDep(@PathVariable Long depId){
        List<EncOtherDocVO> otherDocByDep = service.getOtherDocByDep(depId);
        return JsonResult.ok(otherDocByDep);
    }

    @GetMapping("{articleId}/detail")
    @ApiOperation("百科全书详情页面")
    public JsonResult selectByIdForDetail(@PathVariable Long articleId){
        List<EncDetailVO> encDetailVOS = service.selectByIdForDetail(articleId);
        return JsonResult.ok(encDetailVOS);
    }

    @GetMapping("detail/hot/{depId}")
    @ApiOperation("展示百科全书热门文章")
    public JsonResult selectEncHotDetail(@PathVariable Long depId){
        List<HotDetailVO> encHotDetailVOS = service.selectEncHotDetail(depId);
        return JsonResult.ok(encHotDetailVOS);
    }
}
